//
//  PinglunViewController.m
//  Xiangmu
//
//  Created by 이경인 on 2017/10/23.
//  Copyright © 2017年 LIJINGREN. All rights reserved.
//

#import "PinglunViewController.h"
#import <AFNetworking.h>
@interface PinglunViewController ()

@end

@implementation PinglunViewController

- (void)viewDidLoad {
    
    UIBarButtonItem *fabu = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fabu.jpg"] style:UIBarButtonItemStyleDone target:self action:@selector(fabu)];
    
    self.navigationItem.rightBarButtonItem = fabu;
    self.pingluntext.layer.borderWidth = 1;
    self.pingluntext.layer.borderColor = [[UIColor lightGrayColor]CGColor];
    self.pingluntext.layer.masksToBounds =YES;
   
}
-(void)fabu{
   

    NSUserDefaults *userDe = [NSUserDefaults standardUserDefaults];
    NSString *str =  [userDe objectForKey:@"userID"];
    NSDictionary *dict =@{@"userid":str,@"title":self.pingluntext.text};
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes=[NSSet setWithObject:@"application/json"];
    [manager POST:@"http://172.24.10.175/workout/api.php/create" parameters:dict progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
           NSLog(@"%@",responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
         NSLog(@"%@",error);
    }];

    
    
}
@end
